---
version: 2
interactions:
- id: 0
  request:
    proto: HTTP/1.1
    proto_major: 1
    proto_minor: 1
    content_length: 769
    host: ""
    body: '{"messages":[{"content":"you will generate a short title based on the first message a user begins a conversation with\n\n<rules>\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</rules>\n\n /no_think","role":"system"},{"content":"Generate a concise title for the following content:\n\nuse sourcegraph to search for ''func main'' in Go repositories\n <think>\n\n</think>","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-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":"Search"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":" for"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":" func"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":" main"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":" in"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":" Go"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":" repositories"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":" using"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":" Source"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":"graph"},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]}

      data: {"id":"gen-1761739394-Sje6bTef73gHJt8BJ6QE","provider":"Parasail","model":"qwen/qwen3-next-80b-a3b-instruct","object":"chat.completion.chunk","created":1761739394,"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.0000261,"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.0000121},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}}

      data: [DONE]

    headers:
      Content-Type:
      - text/event-stream
    status: 200 OK
    code: 200
    duration: 660.816458ms
- id: 1
  request:
    proto: HTTP/1.1
    proto_major: 1
    proto_minor: 1
    content_length: 44519
    host: ""
    body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n<critical_rules>\\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</critical_rules>\\n\\n<communication_style>\\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</communication_style>\\n\\n<code_references>\\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</code_references>\\n\\n<workflow>\\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</workflow>\\n\\n<decision_making>\\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</decision_making>\\n\\n<task_scope>\\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</task_scope>\\n\\n<editing_files>\\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</editing_files>\\n\\n<whitespace_and_exact_matching>\\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</whitespace_and_exact_matching>\\n\\n<error_handling>\\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</error_handling>\\n\\n<memory_instructions>\\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</memory_instructions>\\n\\n<code_conventions>\\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</code_conventions>\\n\\n<testing>\\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</testing>\\n\\n<tool_usage>\\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<bash_commands>\\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</bash_commands>\\n</tool_usage>\\n\\n<proactiveness>\\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</proactiveness>\\n\\n<final_answers>\\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</final_answers>\\n\\n<env>\\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</env>\\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<cross_platform>\\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</cross_platform>\\n\\n<execution_steps>\\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 <cwd></cwd> tags\\n</execution_steps>\\n\\n<usage_notes>\\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</usage_notes>\\n\\n<git_commits>\\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 <commit_analysis> 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 &lt;&lt;'EOF'\\n   Commit message here.\\n\\n   \U0001F498 Generated with Crush\\n\\n\\n   Co-Authored-By: Crush <crush@charm.land>\\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</git_commits>\\n\\n<pull_requests>\\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 <pr_analysis> 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 &lt;&lt;'EOF'\\n\\n   ## Summary\\n\\n   &lt;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</pull_requests>\\n\\n<examples>\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n</examples>\\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<usage>\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<tips>\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n</tips>\\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<prerequisites>\\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</prerequisites>\\n\\n<parameters>\\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</parameters>\\n\\n<special_cases>\\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  </special_cases>\\n\\n<critical_requirements>\\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   </critical_requirements>\\n\\n<warnings>\\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</warnings>\\n\\n<recovery_steps>\\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   </recovery_steps>\\n\\n<best_practices>\\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  </best_practices>\\n\\n<whitespace_checklist>\\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      </whitespace_checklist>\\n\\n<examples>\\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</examples>\\n\\n<windows_notes>\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n  </windows_notes>\\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<prerequisites>\\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</prerequisites>\\n\\n<parameters>\\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</parameters>\\n\\n<operation>\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- PARTIAL SUCCESS: If some edits fail, successful edits are still applied. Failed edits are returned in the response.\\n- File is modified if at least one edit succeeds.\\n- Ideal for several changes to different parts of same file.\\n</operation>\\n\\n<inherited_rules>\\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</inherited_rules>\\n\\n<critical_requirements>\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are applied in order; successful edits are kept even if later edits fail.\\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).\\n5. Check the response for failed edits and retry them if needed.\\n</critical_requirements>\\n\\n<verification_before_using>\\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</verification_before_using>\\n\\n<warnings>\\n- Operation continues even if some edits fail; check response for failed edits.\\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</warnings>\\n\\n<recovery_steps>\\nIf some edits fail:\\n1. Check the response metadata for the list of failed edits with their error messages.\\n2. View the file again to see the current state after successful edits.\\n3. Adjust the failed edits based on the new file content.\\n4. Retry the failed edits with corrected old_string values.\\n5. Consider breaking complex batches into smaller, independent operations.\\n</recovery_steps>\\n\\n<best_practices>\\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- Review failed edits in the response and retry with corrections.\\n</best_practices>\\n\\n<whitespace_checklist>\\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</whitespace_checklist>\\n\\n<examples>\\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✅ Correct: Handling partial success\\n\\n```\\n// If edit 2 fails, edit 1 is still applied\\n// Response will indicate:\\n// - edits_applied: 1\\n// - edits_failed: [{index: 2, error: \\\"...\\\", edit: {...}}]\\n// You can then retry edit 2 with corrected context\\n```\\n</examples>\\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<usage>\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<pattern_syntax>\\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</pattern_syntax>\\n\\n<examples>\\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</examples>\\n\\n<limitations>\\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</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<regex_syntax>\\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</regex_syntax>\\n\\n<include_patterns>\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n</include_patterns>\\n\\n<limitations>\\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</limitations>\\n\\n<ignore_support>\\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</ignore_support>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n</usage>\\n\\n<basic_syntax>\\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</basic_syntax>\\n\\n<key_filters>\\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</key_filters>\\n\\n<examples>\\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</examples>\\n\\n<boolean_operators>\\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</boolean_operators>\\n\\n<limitations>\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n</limitations>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n</limitations>\\n\\n<cross_platform>\\n- Use forward slashes (/) for compatibility\\n</cross_platform>\\n\\n<tips>\\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</tips>\\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-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.sourcegraph:0","index":0,"type":"function","function":{"name":"sourcegraph","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"query"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"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-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"\"type"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"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-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"symbol"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" lang"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"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-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"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-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" func"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"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-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"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-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"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-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"count"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"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-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"10"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"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-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]}

      data: {"id":"gen-1761739394-WNlJ6enpJIcNb0wmlw2u","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739394,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10257,"completion_tokens":28,"total_tokens":10285,"cost":0.00405343,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10176,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00400023,"upstream_inference_completions_cost":0.0000532},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}}

      data: [DONE]

    headers:
      Content-Type:
      - text/event-stream
    status: 200 OK
    code: 200
    duration: 1.26659375s
- id: 2
  request:
    proto: HTTP/1.1
    proto_major: 1
    proto_minor: 1
    content_length: 436
    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":"type:symbol lang:go func main"}}'
    headers:
      Content-Type:
      - application/json
      User-Agent:
      - crush/1.0
    url: https://sourcegraph.com/.api/graphql
    method: POST
  response:
    proto: HTTP/2.0
    proto_major: 2
    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/daeuniverse/dae"},"file":{"path":"common/consts/routing.go","url":"/github.com/daeuniverse/dae/-/blob/common/consts/routing.go","content":"/*\n * SPDX-License-Identifier: AGPL-3.0-only\n * Copyright (c) 2022-2025, daeuniverse Organization \u003cdae@v2raya.org\u003e\n */\n\npackage consts\n\ntype RoutingDomainKey string\n\nconst (\n\tRoutingDomainKey_Full    RoutingDomainKey = \"full\"\n\tRoutingDomainKey_Keyword RoutingDomainKey = \"keyword\"\n\tRoutingDomainKey_Suffix  RoutingDomainKey = \"suffix\"\n\tRoutingDomainKey_Regex   RoutingDomainKey = \"regex\"\n\n\tFunction_Domain      = \"domain\"\n\tFunction_Ip          = \"ip\"\n\tFunction_SourceIp    = \"sip\"\n\tFunction_Port        = \"port\"\n\tFunction_SourcePort  = \"sport\"\n\tFunction_L4Proto     = \"l4proto\"\n\tFunction_IpVersion   = \"ipversion\"\n\tFunction_Mac         = \"mac\"\n\tFunction_ProcessName = \"pname\"\n\tFunction_Dscp        = \"dscp\"\n\n\tFunction_QName    = \"qname\"\n\tFunction_QType    = \"qtype\"\n\tFunction_Upstream = \"upstream\"\n\n\tOutboundParam_Mark = \"mark\"\n)\n"},"lineMatches":[]},{"__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":[]},{"__typename":"FileMatch","repository":{"name":"github.com/go-delve/delve"},"file":{"path":"_fixtures/bphitcountchain.go","url":"/github.com/go-delve/delve/-/blob/_fixtures/bphitcountchain.go","content":"package main\n\nimport \"fmt\"\n\nfunc breakfunc1() {\n\tfmt.Println(\"breakfunc1\")\n}\n\nfunc breakfunc2() {\n\tfmt.Println(\"breakfunc2\")\n}\n\nfunc breakfunc3() {\n\tfmt.Println(\"breakfunc3\")\n}\n\nfunc main() {\n\tbreakfunc2()\n\tbreakfunc3()\n\n\tbreakfunc1() // hit\n\tbreakfunc3()\n\tbreakfunc1()\n\n\tbreakfunc2() // hit\n\tbreakfunc1()\n\n\tbreakfunc3() // hit\n\tbreakfunc1()\n\tbreakfunc2()\n}\n"},"lineMatches":[]}]}}}}'
    headers:
      Content-Type:
      - application/json
    status: 200 OK
    code: 200
    duration: 1.462888541s
- id: 3
  request:
    proto: HTTP/1.1
    proto_major: 1
    proto_minor: 1
    content_length: 45322
    host: ""
    body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n<critical_rules>\\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</critical_rules>\\n\\n<communication_style>\\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</communication_style>\\n\\n<code_references>\\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</code_references>\\n\\n<workflow>\\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</workflow>\\n\\n<decision_making>\\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</decision_making>\\n\\n<task_scope>\\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</task_scope>\\n\\n<editing_files>\\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</editing_files>\\n\\n<whitespace_and_exact_matching>\\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</whitespace_and_exact_matching>\\n\\n<error_handling>\\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</error_handling>\\n\\n<memory_instructions>\\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</memory_instructions>\\n\\n<code_conventions>\\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</code_conventions>\\n\\n<testing>\\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</testing>\\n\\n<tool_usage>\\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<bash_commands>\\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</bash_commands>\\n</tool_usage>\\n\\n<proactiveness>\\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</proactiveness>\\n\\n<final_answers>\\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</final_answers>\\n\\n<env>\\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</env>\\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\\\":\\\"type:symbol 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/daeuniverse/dae/common/consts/routing.go\\n\\nURL: /github.com/daeuniverse/dae/-/blob/common/consts/routing.go\\n\\n## Result 2: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n## Result 3: github.com/go-delve/delve/_fixtures/bphitcountchain.go\\n\\nURL: /github.com/go-delve/delve/-/blob/_fixtures/bphitcountchain.go\\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<cross_platform>\\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</cross_platform>\\n\\n<execution_steps>\\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 <cwd></cwd> tags\\n</execution_steps>\\n\\n<usage_notes>\\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</usage_notes>\\n\\n<git_commits>\\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 <commit_analysis> 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 &lt;&lt;'EOF'\\n   Commit message here.\\n\\n   \U0001F498 Generated with Crush\\n\\n\\n   Co-Authored-By: Crush <crush@charm.land>\\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</git_commits>\\n\\n<pull_requests>\\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 <pr_analysis> 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 &lt;&lt;'EOF'\\n\\n   ## Summary\\n\\n   &lt;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</pull_requests>\\n\\n<examples>\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n</examples>\\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<usage>\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<tips>\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n</tips>\\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<prerequisites>\\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</prerequisites>\\n\\n<parameters>\\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</parameters>\\n\\n<special_cases>\\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  </special_cases>\\n\\n<critical_requirements>\\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   </critical_requirements>\\n\\n<warnings>\\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</warnings>\\n\\n<recovery_steps>\\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   </recovery_steps>\\n\\n<best_practices>\\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  </best_practices>\\n\\n<whitespace_checklist>\\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      </whitespace_checklist>\\n\\n<examples>\\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</examples>\\n\\n<windows_notes>\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n  </windows_notes>\\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<prerequisites>\\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</prerequisites>\\n\\n<parameters>\\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</parameters>\\n\\n<operation>\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- PARTIAL SUCCESS: If some edits fail, successful edits are still applied. Failed edits are returned in the response.\\n- File is modified if at least one edit succeeds.\\n- Ideal for several changes to different parts of same file.\\n</operation>\\n\\n<inherited_rules>\\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</inherited_rules>\\n\\n<critical_requirements>\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are applied in order; successful edits are kept even if later edits fail.\\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).\\n5. Check the response for failed edits and retry them if needed.\\n</critical_requirements>\\n\\n<verification_before_using>\\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</verification_before_using>\\n\\n<warnings>\\n- Operation continues even if some edits fail; check response for failed edits.\\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</warnings>\\n\\n<recovery_steps>\\nIf some edits fail:\\n1. Check the response metadata for the list of failed edits with their error messages.\\n2. View the file again to see the current state after successful edits.\\n3. Adjust the failed edits based on the new file content.\\n4. Retry the failed edits with corrected old_string values.\\n5. Consider breaking complex batches into smaller, independent operations.\\n</recovery_steps>\\n\\n<best_practices>\\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- Review failed edits in the response and retry with corrections.\\n</best_practices>\\n\\n<whitespace_checklist>\\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</whitespace_checklist>\\n\\n<examples>\\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✅ Correct: Handling partial success\\n\\n```\\n// If edit 2 fails, edit 1 is still applied\\n// Response will indicate:\\n// - edits_applied: 1\\n// - edits_failed: [{index: 2, error: \\\"...\\\", edit: {...}}]\\n// You can then retry edit 2 with corrected context\\n```\\n</examples>\\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<usage>\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<pattern_syntax>\\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</pattern_syntax>\\n\\n<examples>\\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</examples>\\n\\n<limitations>\\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</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<regex_syntax>\\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</regex_syntax>\\n\\n<include_patterns>\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n</include_patterns>\\n\\n<limitations>\\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</limitations>\\n\\n<ignore_support>\\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</ignore_support>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n</usage>\\n\\n<basic_syntax>\\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</basic_syntax>\\n\\n<key_filters>\\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</key_filters>\\n\\n<examples>\\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</examples>\\n\\n<boolean_operators>\\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</boolean_operators>\\n\\n<limitations>\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n</limitations>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n</limitations>\\n\\n<cross_platform>\\n- Use forward slashes (/) for compatibility\\n</cross_platform>\\n\\n<tips>\\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</tips>\\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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.sourcegraph:1","index":0,"type":"function","function":{"name":"sourcegraph","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"count"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"20"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"query"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"type"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"symbol"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":" lang"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"func"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"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-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]}

      data: {"id":"gen-1761739397-wFKZ5gstq5gmySecxJer","provider":"Parasail","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739397,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":10452,"completion_tokens":32,"total_tokens":10484,"cost":0.00584428,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0057486,"upstream_inference_completions_cost":0.00009568},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}}

      data: [DONE]

    headers:
      Content-Type:
      - text/event-stream
    status: 200 OK
    code: 200
    duration: 1.0930745s
- id: 4
  request:
    proto: HTTP/1.1
    proto_major: 1
    proto_minor: 1
    content_length: 440
    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":"type:symbol lang:go \"func main\""}}'
    headers:
      Content-Type:
      - application/json
      User-Agent:
      - crush/1.0
    url: https://sourcegraph.com/.api/graphql
    method: POST
  response:
    proto: HTTP/2.0
    proto_major: 2
    proto_minor: 0
    content_length: -1
    uncompressed: true
    body: '{"data":{"search":{"results":{"matchCount":0,"limitHit":false,"resultCount":0,"approximateResultCount":"0","missing":[],"timedout":[],"indexUnavailable":false,"results":[]}}}}'
    headers:
      Content-Type:
      - application/json
    status: 200 OK
    code: 200
    duration: 1.416708291s
- id: 5
  request:
    proto: HTTP/1.1
    proto_major: 1
    proto_minor: 1
    content_length: 45707
    host: ""
    body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n<critical_rules>\\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</critical_rules>\\n\\n<communication_style>\\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</communication_style>\\n\\n<code_references>\\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</code_references>\\n\\n<workflow>\\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</workflow>\\n\\n<decision_making>\\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</decision_making>\\n\\n<task_scope>\\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</task_scope>\\n\\n<editing_files>\\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</editing_files>\\n\\n<whitespace_and_exact_matching>\\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</whitespace_and_exact_matching>\\n\\n<error_handling>\\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</error_handling>\\n\\n<memory_instructions>\\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</memory_instructions>\\n\\n<code_conventions>\\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</code_conventions>\\n\\n<testing>\\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</testing>\\n\\n<tool_usage>\\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<bash_commands>\\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</bash_commands>\\n</tool_usage>\\n\\n<proactiveness>\\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</proactiveness>\\n\\n<final_answers>\\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</final_answers>\\n\\n<env>\\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</env>\\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\\\":\\\"type:symbol lang:go func main\\\",\\\"count\\\":10}\",\"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/daeuniverse/dae/common/consts/routing.go\\n\\nURL: /github.com/daeuniverse/dae/-/blob/common/consts/routing.go\\n\\n## Result 2: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n## Result 3: github.com/go-delve/delve/_fixtures/bphitcountchain.go\\n\\nURL: /github.com/go-delve/delve/-/blob/_fixtures/bphitcountchain.go\\n\\n\",\"tool_call_id\":\"functions.sourcegraph:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.sourcegraph:1\",\"function\":{\"arguments\":\"{\\\"count\\\": 20, \\\"query\\\": \\\"type:symbol lang:go \\\\\\\"func main\\\\\\\"\\\"}\",\"name\":\"sourcegraph\"},\"type\":\"function\",\"cache_control\":{\"type\":\"ephemeral\"}}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 0 matches across 0 results\\n\\nNo results found. Try a different query.\\n\",\"tool_call_id\":\"functions.sourcegraph: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<cross_platform>\\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</cross_platform>\\n\\n<execution_steps>\\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 <cwd></cwd> tags\\n</execution_steps>\\n\\n<usage_notes>\\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</usage_notes>\\n\\n<git_commits>\\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 <commit_analysis> 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 &lt;&lt;'EOF'\\n   Commit message here.\\n\\n   \U0001F498 Generated with Crush\\n\\n\\n   Co-Authored-By: Crush <crush@charm.land>\\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</git_commits>\\n\\n<pull_requests>\\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 <pr_analysis> 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 &lt;&lt;'EOF'\\n\\n   ## Summary\\n\\n   &lt;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</pull_requests>\\n\\n<examples>\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n</examples>\\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<usage>\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<tips>\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n</tips>\\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<prerequisites>\\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</prerequisites>\\n\\n<parameters>\\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</parameters>\\n\\n<special_cases>\\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  </special_cases>\\n\\n<critical_requirements>\\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   </critical_requirements>\\n\\n<warnings>\\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</warnings>\\n\\n<recovery_steps>\\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   </recovery_steps>\\n\\n<best_practices>\\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  </best_practices>\\n\\n<whitespace_checklist>\\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      </whitespace_checklist>\\n\\n<examples>\\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</examples>\\n\\n<windows_notes>\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n  </windows_notes>\\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<prerequisites>\\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</prerequisites>\\n\\n<parameters>\\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</parameters>\\n\\n<operation>\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- PARTIAL SUCCESS: If some edits fail, successful edits are still applied. Failed edits are returned in the response.\\n- File is modified if at least one edit succeeds.\\n- Ideal for several changes to different parts of same file.\\n</operation>\\n\\n<inherited_rules>\\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</inherited_rules>\\n\\n<critical_requirements>\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are applied in order; successful edits are kept even if later edits fail.\\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).\\n5. Check the response for failed edits and retry them if needed.\\n</critical_requirements>\\n\\n<verification_before_using>\\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</verification_before_using>\\n\\n<warnings>\\n- Operation continues even if some edits fail; check response for failed edits.\\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</warnings>\\n\\n<recovery_steps>\\nIf some edits fail:\\n1. Check the response metadata for the list of failed edits with their error messages.\\n2. View the file again to see the current state after successful edits.\\n3. Adjust the failed edits based on the new file content.\\n4. Retry the failed edits with corrected old_string values.\\n5. Consider breaking complex batches into smaller, independent operations.\\n</recovery_steps>\\n\\n<best_practices>\\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- Review failed edits in the response and retry with corrections.\\n</best_practices>\\n\\n<whitespace_checklist>\\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</whitespace_checklist>\\n\\n<examples>\\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✅ Correct: Handling partial success\\n\\n```\\n// If edit 2 fails, edit 1 is still applied\\n// Response will indicate:\\n// - edits_applied: 1\\n// - edits_failed: [{index: 2, error: \\\"...\\\", edit: {...}}]\\n// You can then retry edit 2 with corrected context\\n```\\n</examples>\\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<usage>\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<pattern_syntax>\\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</pattern_syntax>\\n\\n<examples>\\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</examples>\\n\\n<limitations>\\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</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<regex_syntax>\\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</regex_syntax>\\n\\n<include_patterns>\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n</include_patterns>\\n\\n<limitations>\\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</limitations>\\n\\n<ignore_support>\\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</ignore_support>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n</usage>\\n\\n<basic_syntax>\\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</basic_syntax>\\n\\n<key_filters>\\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</key_filters>\\n\\n<examples>\\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</examples>\\n\\n<boolean_operators>\\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</boolean_operators>\\n\\n<limitations>\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n</limitations>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n</limitations>\\n\\n<cross_platform>\\n- Use forward slashes (/) for compatibility\\n</cross_platform>\\n\\n<tips>\\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</tips>\\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-1761739400-tDwm6M8nb1kXZ49BtkZc","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739400,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739400-tDwm6M8nb1kXZ49BtkZc","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739400,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"index":0,"id":"functions.sourcegraph:2","function":{"arguments":"{\"count\": 20, \"query\": \"lang:go func main\"}","name":"sourcegraph"},"type":"function"}]},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]}

      data: {"id":"gen-1761739400-tDwm6M8nb1kXZ49BtkZc","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739400,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":11387,"completion_tokens":14,"total_tokens":11401,"cost":0.0057215,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0056935,"upstream_inference_completions_cost":0.000028},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}}

      data: [DONE]

    headers:
      Content-Type:
      - text/event-stream
    status: 200 OK
    code: 200
    duration: 558.216ms
- id: 6
  request:
    proto: HTTP/1.1
    proto_major: 1
    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":"lang:go func main"}}'
    headers:
      Content-Type:
      - application/json
      User-Agent:
      - crush/1.0
    url: https://sourcegraph.com/.api/graphql
    method: POST
  response:
    proto: HTTP/2.0
    proto_major: 2
    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]]}]}]}}}}'
    headers:
      Content-Type:
      - application/json
    status: 200 OK
    code: 200
    duration: 1.238811042s
- id: 7
  request:
    proto: HTTP/1.1
    proto_major: 1
    proto_minor: 1
    content_length: 53424
    host: ""
    body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n<critical_rules>\\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</critical_rules>\\n\\n<communication_style>\\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</communication_style>\\n\\n<code_references>\\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</code_references>\\n\\n<workflow>\\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</workflow>\\n\\n<decision_making>\\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</decision_making>\\n\\n<task_scope>\\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</task_scope>\\n\\n<editing_files>\\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</editing_files>\\n\\n<whitespace_and_exact_matching>\\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</whitespace_and_exact_matching>\\n\\n<error_handling>\\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</error_handling>\\n\\n<memory_instructions>\\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</memory_instructions>\\n\\n<code_conventions>\\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</code_conventions>\\n\\n<testing>\\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</testing>\\n\\n<tool_usage>\\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<bash_commands>\\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</bash_commands>\\n</tool_usage>\\n\\n<proactiveness>\\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</proactiveness>\\n\\n<final_answers>\\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</final_answers>\\n\\n<env>\\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</env>\\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\\\":\\\"type:symbol lang:go func main\\\",\\\"count\\\":10}\",\"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/daeuniverse/dae/common/consts/routing.go\\n\\nURL: /github.com/daeuniverse/dae/-/blob/common/consts/routing.go\\n\\n## Result 2: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n## Result 3: github.com/go-delve/delve/_fixtures/bphitcountchain.go\\n\\nURL: /github.com/go-delve/delve/-/blob/_fixtures/bphitcountchain.go\\n\\n\",\"tool_call_id\":\"functions.sourcegraph:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.sourcegraph:1\",\"function\":{\"arguments\":\"{\\\"count\\\": 20, \\\"query\\\": \\\"type:symbol lang:go \\\\\\\"func main\\\\\\\"\\\"}\",\"name\":\"sourcegraph\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 0 matches across 0 results\\n\\nNo results found. Try a different query.\\n\",\"tool_call_id\":\"functions.sourcegraph:1\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.sourcegraph:2\",\"function\":{\"arguments\":\"{\\\"count\\\": 20, \\\"query\\\": \\\"lang:go func main\\\"}\",\"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\":\"functions.sourcegraph: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<cross_platform>\\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</cross_platform>\\n\\n<execution_steps>\\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 <cwd></cwd> tags\\n</execution_steps>\\n\\n<usage_notes>\\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</usage_notes>\\n\\n<git_commits>\\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 <commit_analysis> 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 &lt;&lt;'EOF'\\n   Commit message here.\\n\\n   \U0001F498 Generated with Crush\\n\\n\\n   Co-Authored-By: Crush <crush@charm.land>\\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</git_commits>\\n\\n<pull_requests>\\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 <pr_analysis> 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 &lt;&lt;'EOF'\\n\\n   ## Summary\\n\\n   &lt;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</pull_requests>\\n\\n<examples>\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n</examples>\\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<usage>\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<tips>\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n</tips>\\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<prerequisites>\\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</prerequisites>\\n\\n<parameters>\\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</parameters>\\n\\n<special_cases>\\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  </special_cases>\\n\\n<critical_requirements>\\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   </critical_requirements>\\n\\n<warnings>\\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</warnings>\\n\\n<recovery_steps>\\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   </recovery_steps>\\n\\n<best_practices>\\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  </best_practices>\\n\\n<whitespace_checklist>\\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      </whitespace_checklist>\\n\\n<examples>\\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</examples>\\n\\n<windows_notes>\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n  </windows_notes>\\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<prerequisites>\\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</prerequisites>\\n\\n<parameters>\\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</parameters>\\n\\n<operation>\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- PARTIAL SUCCESS: If some edits fail, successful edits are still applied. Failed edits are returned in the response.\\n- File is modified if at least one edit succeeds.\\n- Ideal for several changes to different parts of same file.\\n</operation>\\n\\n<inherited_rules>\\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</inherited_rules>\\n\\n<critical_requirements>\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are applied in order; successful edits are kept even if later edits fail.\\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).\\n5. Check the response for failed edits and retry them if needed.\\n</critical_requirements>\\n\\n<verification_before_using>\\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</verification_before_using>\\n\\n<warnings>\\n- Operation continues even if some edits fail; check response for failed edits.\\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</warnings>\\n\\n<recovery_steps>\\nIf some edits fail:\\n1. Check the response metadata for the list of failed edits with their error messages.\\n2. View the file again to see the current state after successful edits.\\n3. Adjust the failed edits based on the new file content.\\n4. Retry the failed edits with corrected old_string values.\\n5. Consider breaking complex batches into smaller, independent operations.\\n</recovery_steps>\\n\\n<best_practices>\\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- Review failed edits in the response and retry with corrections.\\n</best_practices>\\n\\n<whitespace_checklist>\\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</whitespace_checklist>\\n\\n<examples>\\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✅ Correct: Handling partial success\\n\\n```\\n// If edit 2 fails, edit 1 is still applied\\n// Response will indicate:\\n// - edits_applied: 1\\n// - edits_failed: [{index: 2, error: \\\"...\\\", edit: {...}}]\\n// You can then retry edit 2 with corrected context\\n```\\n</examples>\\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<usage>\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<pattern_syntax>\\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</pattern_syntax>\\n\\n<examples>\\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</examples>\\n\\n<limitations>\\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</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<regex_syntax>\\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</regex_syntax>\\n\\n<include_patterns>\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n</include_patterns>\\n\\n<limitations>\\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</limitations>\\n\\n<ignore_support>\\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</ignore_support>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n</usage>\\n\\n<basic_syntax>\\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</basic_syntax>\\n\\n<key_filters>\\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</key_filters>\\n\\n<examples>\\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</examples>\\n\\n<boolean_operators>\\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</boolean_operators>\\n\\n<limitations>\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n</limitations>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n</limitations>\\n\\n<cross_platform>\\n- Use forward slashes (/) for compatibility\\n</cross_platform>\\n\\n<tips>\\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</tips>\\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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":"functions.sourcegraph:3","index":0,"type":"function","function":{"name":"sourcegraph","arguments":""}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"{\"count"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"15"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"query"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"lang"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"choices":[{"index":0,"delta":{"role":"assistant","content":null,"tool_calls":[{"id":null,"index":0,"type":"function","function":{"name":null,"arguments":"func"}}]},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"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-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"tool_calls","native_finish_reason":"tool_calls","logprobs":null}]}

      data: {"id":"gen-1761739403-hFZNoGTSZN2kprPx4yGG","provider":"Chutes","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739403,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":13217,"completion_tokens":31,"total_tokens":13248,"cost":0.00521353,"is_byok":false,"prompt_tokens_details":{"cached_tokens":10176,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.00515463,"upstream_inference_completions_cost":0.0000589},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}}

      data: [DONE]

    headers:
      Content-Type:
      - text/event-stream
    status: 200 OK
    code: 200
    duration: 2.248070166s
- id: 8
  request:
    proto: HTTP/1.1
    proto_major: 1
    proto_minor: 1
    content_length: 443
    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()\" file:main.go"}}'
    headers:
      Content-Type:
      - application/json
      User-Agent:
      - crush/1.0
    url: https://sourcegraph.com/.api/graphql
    method: POST
  response:
    proto: HTTP/2.0
    proto_major: 2
    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/Vrooli/Vrooli"},"file":{"path":"scenarios/scenario-auditor/api/rules/cli/lightweight_main.go","url":"/github.com/Vrooli/Vrooli/-/blob/scenarios/scenario-auditor/api/rules/cli/lightweight_main.go","content":"package cli\n\nimport (\n\t\"strings\"\n)\n\n/*\nRule: Lightweight Main Function\nDescription: Main functions should delegate to cmd.Execute() or similar\nReason: Keeps main() testable and separates concerns between entry point and business logic\nCategory: cli\nSeverity: medium\nStandard: code-structure-v1\nTargets: cli, main_go\n\n\u003ctest-case id=\"complex-main-function\" should-fail=\"true\" path=\"cli/main.go\"\u003e\n  \u003cdescription\u003eMain function with too much business logic\u003c/description\u003e\n  \u003cinput language=\"go\"\u003e\npackage main\n\nimport (\n    \"database/sql\"\n    \"net/http\"\n    \"log\"\n)\n\nfunc main() {\n    // Database setup\n    db, err := sql.Open(\"postgres\", \"connection-string\")\n    if err != nil {\n        log.Fatal(err)\n    }\n    defer db.Close()\n\n    // Create tables\n    if err := createTables(db); err != nil {\n        log.Fatal(err)\n    }\n\n    // Setup routes\n    mux := http.NewServeMux()\n    mux.HandleFunc(\"/api/users\", handleUsers)\n    mux.HandleFunc(\"/api/products\", handleProducts)\n\n    // Setup middleware\n    handler := loggingMiddleware(mux)\n    handler = authMiddleware(handler)\n\n    // Start server\n    log.Println(\"Starting server on :8080\")\n    if err := http.ListenAndServe(\":8080\", handler); err != nil {\n        log.Fatal(err)\n    }\n}\n  \u003c/input\u003e\n  \u003cexpected-violations\u003e2\u003c/expected-violations\u003e\n  \u003cexpected-message\u003eMain function contains too much logic\u003c/expected-message\u003e\n\u003c/test-case\u003e\n\n\u003ctest-case id=\"lightweight-cobra-main\" should-fail=\"false\" path=\"cli/main.go\"\u003e\n  \u003cdescription\u003eMain function delegating to cobra cmd.Execute()\u003c/description\u003e\n  \u003cinput language=\"go\"\u003e\npackage main\n\nimport (\n    \"fmt\"\n    \"os\"\n    \"myapp/cmd\"\n)\n\nfunc main() {\n    if err := cmd.Execute(); err != nil {\n        fmt.Fprintf(os.Stderr, \"Error: %v\\n\", err)\n        os.Exit(1)\n    }\n}\n  \u003c/input\u003e\n\u003c/test-case\u003e\n\n\u003ctest-case id=\"lightweight-urfave-cli\" should-fail=\"false\" path=\"cli/main.go\"\u003e\n  \u003cdescription\u003eMain function using urfave/cli pattern\u003c/description\u003e\n  \u003cinput language=\"go\"\u003e\npackage main\n\nimport (\n    \"log\"\n    \"os\"\n    \"github.com/urfave/cli/v2\"\n)\n\nfunc main() {\n    app := \u0026cli.App{\n        Name:  \"myapp\",\n        Usage: \"Application description\",\n        Commands: setupCommands(),\n    }\n\n    if err := app.Run(os.Args); err != nil {\n        log.Fatal(err)\n    }\n}\n  \u003c/input\u003e\n\u003c/test-case\u003e\n\n\u003ctest-case id=\"minimal-main-with-setup\" should-fail=\"false\" path=\"cli/main.go\"\u003e\n  \u003cdescription\u003eMinimal main that calls a setup function\u003c/description\u003e\n  \u003cinput language=\"go\"\u003e\npackage main\n\nimport (\n    \"log\"\n)\n\nfunc main() {\n    if err := runApplication(); err != nil {\n        log.Fatal(err)\n    }\n}\n\nfunc runApplication() error {\n    // All business logic is here\n    return nil\n}\n  \u003c/input\u003e\n\u003c/test-case\u003e\n*/\n\n// CheckLightweightMain validates that main functions are properly structured\nfunc CheckLightweightMain(content []byte, filePath string) []Violation {\n\tvar violations []Violation\n\tcontentStr := string(content)\n\n\t// Only check main.go files\n\thasMainFunc := strings.Contains(contentStr, \"func main()\")\n\tif !(strings.HasSuffix(filePath, \"main.go\") \u0026\u0026 hasMainFunc) {\n\t\tif !(strings.Contains(contentStr, \"package main\") \u0026\u0026 hasMainFunc) {\n\t\t\treturn violations\n\t\t}\n\t}\n\n\t// Find main function\n\tlines := strings.Split(contentStr, \"\\n\")\n\tmainStart := -1\n\tmainEnd := -1\n\tbraceCount := 0\n\n\tfor i, line := range lines {\n\t\tif strings.Contains(line, \"func main()\") {\n\t\t\tmainStart = i\n\t\t\tbraceCount = 1\n\t\t\tcontinue\n\t\t}\n\n\t\tif mainStart \u003e= 0 {\n\t\t\tbraceCount += strings.Count(line, \"{\")\n\t\t\tbraceCount -= strings.Count(line, \"}\")\n\n\t\t\tif braceCount == 0 {\n\t\t\t\tmainEnd = i\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif mainStart \u003e= 0 \u0026\u0026 mainEnd \u003e= 0 {\n\t\tmainLines := mainEnd - mainStart\n\n\t\t// Check if main is too complex (more than 20 lines suggests it''s doing too much)\n\t\tif mainLines \u003e 20 {\n\t\t\t// Check if it''s delegating to cmd.Execute or similar\n\t\t\thasCmdPattern := false\n\t\t\tfor i := mainStart; i \u003c= mainEnd; i++ {\n\t\t\t\tline := lines[i]\n\t\t\t\tif strings.Contains(line, \"cmd.Execute\") ||\n\t\t\t\t\tstrings.Contains(line, \"app.Run\") ||\n\t\t\t\t\tstrings.Contains(line, \"rootCmd.Execute\") ||\n\t\t\t\t\tstrings.Contains(line, \"cli.Run\") {\n\t\t\t\t\thasCmdPattern = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !hasCmdPattern {\n\t\t\t\tviolations = append(violations, Violation{\n\t\t\t\t\tType:           \"lightweight_main\",\n\t\t\t\t\tSeverity:       \"medium\",\n\t\t\t\t\tTitle:          \"Complex Main Function\",\n\t\t\t\t\tDescription:    \"Main function contains too much logic (\u003e20 lines)\",\n\t\t\t\t\tFilePath:       filePath,\n\t\t\t\t\tLineNumber:     mainStart + 1,\n\t\t\t\t\tCodeSnippet:    \"func main() { ... \" + strings.TrimSpace(lines[mainStart+1]) + \" ... }\",\n\t\t\t\t\tRecommendation: \"Refactor to use cmd.Execute() pattern or extract logic to separate functions\",\n\t\t\t\t\tStandard:       \"code-structure-v1\",\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Check for direct business logic in main\n\t\tbusinessLogicIndicators := []string{\n\t\t\t\"database\",\n\t\t\t\"sql.Open\",\n\t\t\t\"http.ListenAndServe\",\n\t\t\t\"gin.Run\",\n\t\t\t\"fiber.Listen\",\n\t\t\t\"for {\",    // Main loops\n\t\t\t\"select {\", // Channel operations\n\t\t}\n\n\t\tbusinessLogicReported := false\n\t\tfor i := mainStart + 1; i \u003c mainEnd; i++ {\n\t\t\tline := lines[i]\n\t\t\tfor _, indicator := range businessLogicIndicators {\n\t\t\t\tif strings.Contains(line, indicator) \u0026\u0026 !strings.Contains(line, \"//\") {\n\t\t\t\t\tviolations = append(violations, Violation{\n\t\t\t\t\t\tType:           \"lightweight_main\",\n\t\t\t\t\t\tSeverity:       \"medium\",\n\t\t\t\t\t\tTitle:          \"Business Logic in Main\",\n\t\t\t\t\t\tDescription:    \"Main function contains direct business logic\",\n\t\t\t\t\t\tFilePath:       filePath,\n\t\t\t\t\t\tLineNumber:     i + 1,\n\t\t\t\t\t\tCodeSnippet:    line,\n\t\t\t\t\t\tRecommendation: \"Move to a Run() or Execute() function called from main()\",\n\t\t\t\t\t\tStandard:       \"code-structure-v1\",\n\t\t\t\t\t})\n\t\t\t\t\tbusinessLogicReported = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif businessLogicReported {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn violations\n}\n"},"lineMatches":[{"preview":"\t\tif strings.Contains(line, \"func main()\") {","lineNumber":147,"offsetAndLengths":[[28,13]]},{"preview":"\thasMainFunc := strings.Contains(contentStr, \"func main()\")","lineNumber":133,"offsetAndLengths":[[45,13]]},{"preview":"func main() {","lineNumber":26,"offsetAndLengths":[[0,11]]},{"preview":"func main() {","lineNumber":70,"offsetAndLengths":[[0,11]]},{"preview":"func main() {","lineNumber":90,"offsetAndLengths":[[0,11]]},{"preview":"func main() {","lineNumber":113,"offsetAndLengths":[[0,11]]},{"preview":"\t\t\t\t\tCodeSnippet:    \"func main() { ... \" + strings.TrimSpace(lines[mainStart+1]) + \" ... }\",","lineNumber":190,"offsetAndLengths":[[22,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/cloudflare/ct-log"},"file":{"path":"vendor/github.com/gobuffalo/buffalo/buffalo/cmd/build/transform_main.go","url":"/github.com/cloudflare/ct-log/-/blob/vendor/github.com/gobuffalo/buffalo/buffalo/cmd/build/transform_main.go","content":"package build\n\nimport (\n\t\"bytes\"\n\t\"io\"\n\t\"os\"\n\t\"os/exec\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/gobuffalo/plush\"\n\t\"github.com/pkg/errors\"\n\t\"github.com/sirupsen/logrus\"\n)\n\nfunc (b *Builder) transformMain() error {\n\tlogrus.Debug(\"transforming main() to originalMain()\")\n\n\treturn b.transform(\"main.go\", func(body []byte, w io.Writer) error {\n\t\tbody = bytes.Replace(body, []byte(\"func main()\"), []byte(\"func originalMain()\"), 1)\n\t\t_, err := w.Write(body)\n\t\tif err != nil {\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\treturn nil\n\t})\n}\n\nfunc (b *Builder) buildVersion(version string) string {\n\tif b.Options.VCS == \"git\" {\n\t\t_, err := exec.LookPath(\"git\")\n\t\tif err != nil {\n\t\t\treturn version\n\t\t}\n\t\tcmd := exec.Command(\"git\", \"rev-parse\", \"--short\", \"HEAD\")\n\t\tout := \u0026bytes.Buffer{}\n\t\tcmd.Stdout = out\n\t\tcmd.Stderr = os.Stderr\n\t\tcmd.Stdin = os.Stdin\n\t\terr = cmd.Run()\n\t\tif err == nil \u0026\u0026 out.String() != \"\" {\n\t\t\tversion = strings.TrimSpace(out.String())\n\t\t}\n\t} else if b.Options.VCS == \"bzr\" {\n\t\t_, err := exec.LookPath(\"bzr\")\n\t\tif err != nil {\n\t\t\treturn version\n\t\t}\n\t\tcmd := exec.Command(\"bzr\", \"revno\")\n\t\tout := \u0026bytes.Buffer{}\n\t\tcmd.Stdout = out\n\t\tcmd.Stderr = os.Stderr\n\t\tcmd.Stdin = os.Stdin\n\t\terr = cmd.Run()\n\t\tif err == nil \u0026\u0026 out.String() != \"\" {\n\t\t\tversion = strings.TrimSpace(out.String())\n\t\t}\n\t}\n\treturn version\n}\n\nfunc (b *Builder) createBuildMain() error {\n\tctx := plush.NewContext()\n\tctx.Set(\"opts\", b.Options)\n\n\tbt := time.Now().Format(time.RFC3339)\n\tctx.Set(\"buildTime\", bt)\n\tctx.Set(\"buildVersion\", b.buildVersion(bt))\n\n\tt, err := templates.MustString(\"main.go.tmpl\")\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\ts, err := plush.Render(t, ctx)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\n\tbbm := filepath.Join(b.Root, \"buffalo_build_main.go\")\n\tlogrus.Debugf(\"creating %s\", bbm)\n\tf, err := os.Create(bbm)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tdefer f.Close()\n\tb.cleanups = append(b.cleanups, func() error {\n\t\treturn os.RemoveAll(bbm)\n\t})\n\tf.WriteString(s)\n\treturn nil\n}\n"},"lineMatches":[{"preview":"\t\tbody = bytes.Replace(body, []byte(\"func main()\"), []byte(\"func originalMain()\"), 1)","lineNumber":20,"offsetAndLengths":[[36,13]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/unmeshjoshi/distributedarchitectures"},"file":{"path":"src/main/go/main.go","url":"/github.com/unmeshjoshi/distributedarchitectures/-/blob/src/main/go/main.go","content":"package main\n\nfunc main() {\n\tindex\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":2,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/OrangeAVA/Modern-Web-Development-with-Go"},"file":{"path":"Chapter 01/basic-concepts-of-go-examples-main/goplaygroud/main.go","url":"/github.com/OrangeAVA/Modern-Web-Development-with-Go/-/blob/Chapter%2001/basic-concepts-of-go-examples-main/goplaygroud/main.go","content":"package main\n\nimport \"fmt\"\n\nfunc main() {\n\ta := 2\n\tb := 3\n\tc := a * b\n\tfmt.Println(\"Result is: \", c)\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":4,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/bazel-contrib/rules_go"},"file":{"path":"tests/core/go_binary/tags_main_good.go","url":"/github.com/bazel-contrib/rules_go/-/blob/tests/core/go_binary/tags_main_good.go","content":"// +build good\n\npackage main\n\nimport _ \"tags_lib\"\n\nfunc main() {\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":6,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/Balun-courses/concurrency_go"},"file":{"path":"lessons/5_lesson_channels/select_with_main_goroutine/main.go","url":"/github.com/Balun-courses/concurrency_go/-/blob/lessons/5_lesson_channels/select_with_main_goroutine/main.go","content":"package main\n\nimport \"runtime\"\n\nfunc doSomething() {\n\tfor {\n\t\truntime.Gosched()\n\t}\n}\n\nfunc main() {\n\tgo doSomething()\n\tgo doSomething()\n\tselect {}\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":10,"offsetAndLengths":[[0,11]]}]},{"__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":[{"preview":"func main() {","lineNumber":6,"offsetAndLengths":[[0,11]]},{"preview":"func Main() int {","lineNumber":10,"offsetAndLengths":[[0,11]]}]},{"__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":[{"preview":"func main() {","lineNumber":4,"offsetAndLengths":[[0,11]]},{"preview":"func main() {","lineNumber":10,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/grmartin/clion-go-lang-cmake"},"file":{"path":"src/main/go/main.go","url":"/github.com/grmartin/clion-go-lang-cmake/-/blob/src/main/go/main.go","content":"package main\n\nimport \"fmt\"\n\nfunc main() {\n\n\tvar a string = \"initial\"\n\tfmt.Println(a)\n\tvar b, c int = 1, 2\n\tfmt.Println(b, c)\n\tvar d = true\n\tfmt.Println(d)\n\tvar e int\n\tfmt.Println(e)\n\n\tf := \"short\"\n\tfmt.Println(f)\n\n\tfmt.Printf(\"Hello, world.\\n\")\n\n}"},"lineMatches":[{"preview":"func main() {","lineNumber":4,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/cubxxw/awesome-cloud-native"},"file":{"path":"docs/code-docker-super/main/go-docker-1.go","url":"/github.com/cubxxw/awesome-cloud-native/-/blob/docs/code-docker-super/main/go-docker-1.go","content":"package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"os/exec\"\n)\n\nfunc main() {\n\tfmt.Println(os.Args)\n\tswitch os.Args[1] {\t //获取第一个参数（从程序名开始）\n\tcase \"run\":\n\t\trun()\n\tdefault:\n\t\tpanic(\"have not define\")\n\t}\n}\nfunc run() {\n\tcmd := exec.Command(os.Args[2])\t//获取第二个参数\n\tcmd.Stdin = os.Stdin\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\tcmd.Run()\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":8,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/timakin/bodyclose"},"file":{"path":"main_go112.go","url":"/github.com/timakin/bodyclose/-/blob/main_go112.go","content":"// +build go1.12\n\npackage main\n\nimport (\n\t\"github.com/timakin/bodyclose/passes/bodyclose\"\n\t\"golang.org/x/tools/go/analysis\"\n\t\"golang.org/x/tools/go/analysis/unitchecker\"\n)\n\n// Analyzers returns analyzers of bodyclose.\nfunc analyzers() []*analysis.Analyzer {\n\treturn []*analysis.Analyzer{\n\t\tbodyclose.Analyzer,\n\t}\n}\n\nfunc main() {\n\tunitchecker.Main(analyzers()...)\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":17,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/cubxxw/awesome-cloud-native"},"file":{"path":"docs/code-docker-super/main/go-docker-3.go","url":"/github.com/cubxxw/awesome-cloud-native/-/blob/docs/code-docker-super/main/go-docker-3.go","content":"package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"log\"\n\t\"os/exec\"\n\t\"strings\"\n)\n\nfunc main() {\n\tcmd := exec.Command(\"tr\", \"a-z\", \"A-Z\")\n\t//command 的作用是执行一个命令，返回一个*Cmd，用于使用给出的参数执行name指定的程序。\n\tcmd.Stdin = strings.NewReader(\"some input\")\n\tvar out bytes.Buffer\n\tcmd.Stdout = \u0026out\n\terr := cmd.Run()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"in all caps: %q\\n\", out.String())\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":10,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/kubevirt/ssp-operator"},"file":{"path":"internal/template-validator/main.go","url":"/github.com/kubevirt/ssp-operator/-/blob/internal/template-validator/main.go","content":"package main\n\nimport (\n\t\"os\"\n\n\t\"kubevirt.io/ssp-operator/internal/template-validator/service\"\n\t\"kubevirt.io/ssp-operator/internal/template-validator/validator\"\n)\n\nfunc Main() int {\n\tapp := \u0026validator.App{}\n\tservice.Setup(app)\n\tapp.Run()\n\treturn 0\n}\n\nfunc main() {\n\tos.Exit(Main())\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":16,"offsetAndLengths":[[0,11]]},{"preview":"func Main() int {","lineNumber":9,"offsetAndLengths":[[0,11]]}]},{"__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":[{"preview":"func main() {","lineNumber":18,"offsetAndLengths":[[0,11]]},{"preview":"func main() { @@.Checker@@checker.Main(@@.Pkg@@.Analyzer) }","lineNumber":8,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/golang-basics/concurrency"},"file":{"path":"mutexes/contexts/single-and-main-gouroutine/main.go","url":"/github.com/golang-basics/concurrency/-/blob/mutexes/contexts/single-and-main-gouroutine/main.go","content":"package main\n\nimport (\n\t\"fmt\"\n\t\"sync\"\n)\n\n// try running this with the -race flag\n// go run -race main.go\nfunc main() {\n\tvar wg sync.WaitGroup\n\tvar count int\n\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\t// G1 will attempt a read operation\n\t\t//fmt.Println(count)\n\t\t// G1 will attempt a write operation\n\t\tcount++\n\t}()\n\t// Main G will also attempt a write operation\n\tcount++\n\n\twg.Wait()\n\tfmt.Println(\"count\", count)\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":9,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/cubxxw/awesome-cloud-native"},"file":{"path":"docs/code-docker-super/main/go-docker-2.go","url":"/github.com/cubxxw/awesome-cloud-native/-/blob/docs/code-docker-super/main/go-docker-2.go","content":"package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"os/exec\"\n\t\"syscall\"\n)\n\nfunc main() {\n\tfmt.Println(\"os.Args\")\n\tswitch os.Args[1] {\n\tcase \"run\":\n\t\trun()\n\tdefault:\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t}()\n\t\tpanic(\"have not define\")\n\t}\n}\n\nfunc run() {\n\tcmd := exec.Command(os.Args[2])\n\tcmd.SysProcAttr = \u0026syscall.SysProcAttr{\n\t\tCloneflags: syscall.CLONE_NEWUTS,\n\t}\n\tcmd.Stdin = os.Stdin\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\tif err := cmd.Run(); err != nil {\n\t\tpanic(err)\n\t}\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":9,"offsetAndLengths":[[0,11]]}]},{"__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":[{"preview":"func main() {","lineNumber":19,"offsetAndLengths":[[0,11]]},{"preview":"func main() { multichecker.Main(@@.Pkg@@.Analyzer) }","lineNumber":9,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/MilitaryIntelligence6/Cva"},"file":{"path":"Cvac/src/main/go/golang/main/cvac.go","url":"/github.com/MilitaryIntelligence6/Cva/-/blob/Cvac/src/main/go/golang/main/cvac.go","content":"package main\n\nimport (\n\tmyPkg \"MyPkg/PkgTest/test\"\n\t\"fmt\"\n\t\"os/exec\"\n)\n\nfunc main() {\n\t//handler.\n\tvar shellDir string = HandleShellPath()\n\tfmt.Printf(\"shell path is %s\\n\\n\", shellDir)\n\n\tvar homeDir string = HandleHomePath()\n\tfmt.Printf(\"home path is %s\\n\\n\", homeDir)\n\n\tcmd := exec.Command(\"java -version\")\n\t// 执行命令，返回命令是否执行成功\n\tvar output, err = cmd.Output()\n\tif err != nil {\n\t\t// 命令执行失败\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"%s\\n\", output)\n\tmyPkg.EchoPkg()\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":8,"offsetAndLengths":[[0,11]]}]},{"__typename":"FileMatch","repository":{"name":"github.com/MilitaryIntelligence6/Cva"},"file":{"path":"utils/src/main/go/golang/main/cvac.go","url":"/github.com/MilitaryIntelligence6/Cva/-/blob/utils/src/main/go/golang/main/cvac.go","content":"package main\n\nimport (\n\tmyPkg \"MyPkg/PkgTest/test\"\n\t\"fmt\"\n\t\"os/exec\"\n)\n\nfunc main() {\n\t//handler.\n\tvar shellDir string = HandleShellPath()\n\tfmt.Printf(\"shell path is %s\\n\\n\", shellDir)\n\n\tvar homeDir string = HandleHomePath()\n\tfmt.Printf(\"home path is %s\\n\\n\", homeDir)\n\n\tcmd := exec.Command(\"java -version\")\n\t// 执行命令，返回命令是否执行成功\n\tvar output, err = cmd.Output()\n\tif err != nil {\n\t\t// 命令执行失败\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"%s\\n\", output)\n\tmyPkg.EchoPkg()\n}\n"},"lineMatches":[{"preview":"func main() {","lineNumber":8,"offsetAndLengths":[[0,11]]}]}]}}}}'
    headers:
      Content-Type:
      - application/json
    status: 200 OK
    code: 200
    duration: 1.281728834s
- id: 9
  request:
    proto: HTTP/1.1
    proto_major: 1
    proto_minor: 1
    content_length: 63502
    host: ""
    body: "{\"messages\":[{\"content\":\"You are Crush, a powerful AI Assistant that runs in the CLI.\\n\\n<critical_rules>\\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</critical_rules>\\n\\n<communication_style>\\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</communication_style>\\n\\n<code_references>\\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</code_references>\\n\\n<workflow>\\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</workflow>\\n\\n<decision_making>\\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</decision_making>\\n\\n<task_scope>\\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</task_scope>\\n\\n<editing_files>\\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</editing_files>\\n\\n<whitespace_and_exact_matching>\\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</whitespace_and_exact_matching>\\n\\n<error_handling>\\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</error_handling>\\n\\n<memory_instructions>\\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</memory_instructions>\\n\\n<code_conventions>\\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</code_conventions>\\n\\n<testing>\\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</testing>\\n\\n<tool_usage>\\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<bash_commands>\\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</bash_commands>\\n</tool_usage>\\n\\n<proactiveness>\\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</proactiveness>\\n\\n<final_answers>\\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</final_answers>\\n\\n<env>\\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</env>\\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\\\":\\\"type:symbol lang:go func main\\\",\\\"count\\\":10}\",\"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/daeuniverse/dae/common/consts/routing.go\\n\\nURL: /github.com/daeuniverse/dae/-/blob/common/consts/routing.go\\n\\n## Result 2: github.com/jcalabro/uscope/assets/gobacktrace/main.go\\n\\nURL: /github.com/jcalabro/uscope/-/blob/assets/gobacktrace/main.go\\n\\n## Result 3: github.com/go-delve/delve/_fixtures/bphitcountchain.go\\n\\nURL: /github.com/go-delve/delve/-/blob/_fixtures/bphitcountchain.go\\n\\n\",\"tool_call_id\":\"functions.sourcegraph:0\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.sourcegraph:1\",\"function\":{\"arguments\":\"{\\\"count\\\": 20, \\\"query\\\": \\\"type:symbol lang:go \\\\\\\"func main\\\\\\\"\\\"}\",\"name\":\"sourcegraph\"},\"type\":\"function\"}],\"role\":\"assistant\"},{\"content\":\"# Sourcegraph Search Results\\n\\nFound 0 matches across 0 results\\n\\nNo results found. Try a different query.\\n\",\"tool_call_id\":\"functions.sourcegraph:1\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.sourcegraph:2\",\"function\":{\"arguments\":\"{\\\"count\\\": 20, \\\"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\":\"functions.sourcegraph:2\",\"role\":\"tool\"},{\"tool_calls\":[{\"id\":\"functions.sourcegraph:3\",\"function\":{\"arguments\":\"{\\\"count\\\":15,\\\"query\\\":\\\"lang:go \\\\\\\"func main()\\\\\\\" file:main.go\\\"}\",\"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/Vrooli/Vrooli/scenarios/scenario-auditor/api/rules/cli/lightweight_main.go\\n\\nURL: /github.com/Vrooli/Vrooli/-/blob/scenarios/scenario-auditor/api/rules/cli/lightweight_main.go\\n\\n```\\n137| \\t\\t\\treturn violations\\n138| \\t\\t}\\n139| \\t}\\n140| \\n141| \\t// Find main function\\n142| \\tlines := strings.Split(contentStr, \\\"\\\\n\\\")\\n143| \\tmainStart := -1\\n144| \\tmainEnd := -1\\n145| \\tbraceCount := 0\\n146| \\n147|  \\t\\tif strings.Contains(line, \\\"func main()\\\") {\\n148| \\t\\tif strings.Contains(line, \\\"func main()\\\") {\\n149| \\t\\t\\tmainStart = i\\n150| \\t\\t\\tbraceCount = 1\\n151| \\t\\t\\tcontinue\\n152| \\t\\t}\\n153| \\n154| \\t\\tif mainStart >= 0 {\\n155| \\t\\t\\tbraceCount += strings.Count(line, \\\"{\\\")\\n156| \\t\\t\\tbraceCount -= strings.Count(line, \\\"}\\\")\\n157| \\n```\\n\\n```\\n123| }\\n124|   </input>\\n125| </test-case>\\n126| */\\n127| \\n128| // CheckLightweightMain validates that main functions are properly structured\\n129| func CheckLightweightMain(content []byte, filePath string) []Violation {\\n130| \\tvar violations []Violation\\n131| \\tcontentStr := string(content)\\n132| \\n133|  \\thasMainFunc := strings.Contains(contentStr, \\\"func main()\\\")\\n134| \\thasMainFunc := strings.Contains(contentStr, \\\"func main()\\\")\\n135| \\tif !(strings.HasSuffix(filePath, \\\"main.go\\\") && hasMainFunc) {\\n136| \\t\\tif !(strings.Contains(contentStr, \\\"package main\\\") && hasMainFunc) {\\n137| \\t\\t\\treturn violations\\n138| \\t\\t}\\n139| \\t}\\n140| \\n141| \\t// Find main function\\n142| \\tlines := strings.Split(contentStr, \\\"\\\\n\\\")\\n143| \\tmainStart := -1\\n```\\n\\n```\\n16| <test-case id=\\\"complex-main-function\\\" should-fail=\\\"true\\\" path=\\\"cli/main.go\\\">\\n17|   <description>Main function with too much business logic</description>\\n18|   <input language=\\\"go\\\">\\n19| package main\\n20| \\n21| import (\\n22|     \\\"database/sql\\\"\\n23|     \\\"net/http\\\"\\n24|     \\\"log\\\"\\n25| )\\n26|  func main() {\\n27| func main() {\\n28|     // Database setup\\n29|     db, err := sql.Open(\\\"postgres\\\", \\\"connection-string\\\")\\n30|     if err != nil {\\n31|         log.Fatal(err)\\n32|     }\\n33|     defer db.Close()\\n34| \\n35|     // Create tables\\n36|     if err := createTables(db); err != nil {\\n```\\n\\n```\\n60| <test-case id=\\\"lightweight-cobra-main\\\" should-fail=\\\"false\\\" path=\\\"cli/main.go\\\">\\n61|   <description>Main function delegating to cobra cmd.Execute()</description>\\n62|   <input language=\\\"go\\\">\\n63| package main\\n64| \\n65| import (\\n66|     \\\"fmt\\\"\\n67|     \\\"os\\\"\\n68|     \\\"myapp/cmd\\\"\\n69| )\\n70|  func main() {\\n71| func main() {\\n72|     if err := cmd.Execute(); err != nil {\\n73|         fmt.Fprintf(os.Stderr, \\\"Error: %v\\\\n\\\", err)\\n74|         os.Exit(1)\\n75|     }\\n76| }\\n77|   </input>\\n78| </test-case>\\n79| \\n80| <test-case id=\\\"lightweight-urfave-cli\\\" should-fail=\\\"false\\\" path=\\\"cli/main.go\\\">\\n```\\n\\n```\\n80| <test-case id=\\\"lightweight-urfave-cli\\\" should-fail=\\\"false\\\" path=\\\"cli/main.go\\\">\\n81|   <description>Main function using urfave/cli pattern</description>\\n82|   <input language=\\\"go\\\">\\n83| package main\\n84| \\n85| import (\\n86|     \\\"log\\\"\\n87|     \\\"os\\\"\\n88|     \\\"github.com/urfave/cli/v2\\\"\\n89| )\\n90|  func main() {\\n91| func main() {\\n92|     app := &cli.App{\\n93|         Name:  \\\"myapp\\\",\\n94|         Usage: \\\"Application description\\\",\\n95|         Commands: setupCommands(),\\n96|     }\\n97| \\n98|     if err := app.Run(os.Args); err != nil {\\n99|         log.Fatal(err)\\n100|     }\\n```\\n\\n```\\n103| </test-case>\\n104| \\n105| <test-case id=\\\"minimal-main-with-setup\\\" should-fail=\\\"false\\\" path=\\\"cli/main.go\\\">\\n106|   <description>Minimal main that calls a setup function</description>\\n107|   <input language=\\\"go\\\">\\n108| package main\\n109| \\n110| import (\\n111|     \\\"log\\\"\\n112| )\\n113|  func main() {\\n114| func main() {\\n115|     if err := runApplication(); err != nil {\\n116|         log.Fatal(err)\\n117|     }\\n118| }\\n119| \\n120| func runApplication() error {\\n121|     // All business logic is here\\n122|     return nil\\n123| }\\n```\\n\\n```\\n180| \\t\\t\\t\\t}\\n181| \\t\\t\\t}\\n182| \\n183| \\t\\t\\tif !hasCmdPattern {\\n184| \\t\\t\\t\\tviolations = append(violations, Violation{\\n185| \\t\\t\\t\\t\\tType:           \\\"lightweight_main\\\",\\n186| \\t\\t\\t\\t\\tSeverity:       \\\"medium\\\",\\n187| \\t\\t\\t\\t\\tTitle:          \\\"Complex Main Function\\\",\\n188| \\t\\t\\t\\t\\tDescription:    \\\"Main function contains too much logic (>20 lines)\\\",\\n189| \\t\\t\\t\\t\\tFilePath:       filePath,\\n190|  \\t\\t\\t\\t\\tCodeSnippet:    \\\"func main() { ... \\\" + strings.TrimSpace(lines[mainStart+1]) + \\\" ... }\\\",\\n191| \\t\\t\\t\\t\\tCodeSnippet:    \\\"func main() { ... \\\" + strings.TrimSpace(lines[mainStart+1]) + \\\" ... }\\\",\\n192| \\t\\t\\t\\t\\tRecommendation: \\\"Refactor to use cmd.Execute() pattern or extract logic to separate functions\\\",\\n193| \\t\\t\\t\\t\\tStandard:       \\\"code-structure-v1\\\",\\n194| \\t\\t\\t\\t})\\n195| \\t\\t\\t}\\n196| \\t\\t}\\n197| \\n198| \\t\\t// Check for direct business logic in main\\n199| \\t\\tbusinessLogicIndicators := []string{\\n200| \\t\\t\\t\\\"database\\\",\\n```\\n\\n## Result 2: github.com/cloudflare/ct-log/vendor/github.com/gobuffalo/buffalo/buffalo/cmd/build/transform_main.go\\n\\nURL: /github.com/cloudflare/ct-log/-/blob/vendor/github.com/gobuffalo/buffalo/buffalo/cmd/build/transform_main.go\\n\\n```\\n10| \\t\\\"time\\\"\\n11| \\n12| \\t\\\"github.com/gobuffalo/plush\\\"\\n13| \\t\\\"github.com/pkg/errors\\\"\\n14| \\t\\\"github.com/sirupsen/logrus\\\"\\n15| )\\n16| \\n17| func (b *Builder) transformMain() error {\\n18| \\tlogrus.Debug(\\\"transforming main() to originalMain()\\\")\\n19| \\n20|  \\t\\tbody = bytes.Replace(body, []byte(\\\"func main()\\\"), []byte(\\\"func originalMain()\\\"), 1)\\n21| \\t\\tbody = bytes.Replace(body, []byte(\\\"func main()\\\"), []byte(\\\"func originalMain()\\\"), 1)\\n22| \\t\\t_, err := w.Write(body)\\n23| \\t\\tif err != nil {\\n24| \\t\\t\\treturn errors.WithStack(err)\\n25| \\t\\t}\\n26| \\t\\treturn nil\\n27| \\t})\\n28| }\\n29| \\n30| func (b *Builder) buildVersion(version string) string {\\n```\\n\\n## Result 3: github.com/unmeshjoshi/distributedarchitectures/src/main/go/main.go\\n\\nURL: /github.com/unmeshjoshi/distributedarchitectures/-/blob/src/main/go/main.go\\n\\n```\\n1| package main\\n2|  func main() {\\n3| func main() {\\n4| \\tindex\\n5| }\\n6| \\n```\\n\\n## Result 4: github.com/OrangeAVA/Modern-Web-Development-with-Go/Chapter 01/basic-concepts-of-go-examples-main/goplaygroud/main.go\\n\\nURL: /github.com/OrangeAVA/Modern-Web-Development-with-Go/-/blob/Chapter%2001/basic-concepts-of-go-examples-main/goplaygroud/main.go\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4|  func main() {\\n5| func main() {\\n6| \\ta := 2\\n7| \\tb := 3\\n8| \\tc := a * b\\n9| \\tfmt.Println(\\\"Result is: \\\", c)\\n10| }\\n11| \\n```\\n\\n## Result 5: github.com/bazel-contrib/rules_go/tests/core/go_binary/tags_main_good.go\\n\\nURL: /github.com/bazel-contrib/rules_go/-/blob/tests/core/go_binary/tags_main_good.go\\n\\n```\\n1| // +build good\\n2| \\n3| package main\\n4| \\n5| import _ \\\"tags_lib\\\"\\n6|  func main() {\\n7| func main() {\\n8| }\\n9| \\n```\\n\\n## Result 6: github.com/Balun-courses/concurrency_go/lessons/5_lesson_channels/select_with_main_goroutine/main.go\\n\\nURL: /github.com/Balun-courses/concurrency_go/-/blob/lessons/5_lesson_channels/select_with_main_goroutine/main.go\\n\\n```\\n1| package main\\n2| \\n3| import \\\"runtime\\\"\\n4| \\n5| func doSomething() {\\n6| \\tfor {\\n7| \\t\\truntime.Gosched()\\n8| \\t}\\n9| }\\n10|  func main() {\\n11| func main() {\\n12| \\tgo doSomething()\\n13| \\tgo doSomething()\\n14| \\tselect {}\\n15| }\\n16| \\n```\\n\\n## Result 7: github.com/jiro4989/textimg/main.go\\n\\nURL: /github.com/jiro4989/textimg/-/blob/main.go\\n\\n```\\n1| package main\\n2| \\n3| import (\\n4| \\t\\\"os\\\"\\n5| )\\n6|  func main() {\\n7| func main() {\\n8| \\tos.Exit(Main())\\n9| }\\n10| \\n11| func Main() int {\\n12| \\tif err := RootCommand.Execute(); err != nil {\\n13| \\t\\treturn -1\\n14| \\t}\\n15| \\treturn 0\\n16| }\\n```\\n\\n```\\n1| package main\\n2| \\n3| import (\\n4| \\t\\\"os\\\"\\n5| )\\n6| \\n7| func main() {\\n8| \\tos.Exit(Main())\\n9| }\\n10|  func Main() int {\\n11| func Main() int {\\n12| \\tif err := RootCommand.Execute(); err != nil {\\n13| \\t\\treturn -1\\n14| \\t}\\n15| \\treturn 0\\n16| }\\n17| \\n```\\n\\n## Result 8: 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```\\n1| package main\\n2| \\n3| import \\\"concurrency/examples\\\"\\n4|  func main() {\\n5| func main() {\\n6| \\texamples.RunHttpExample2()\\n7| \\t//examples.RunHttpUExample2()\\n8| }\\n9| package main\\n10| \\n11| func main() {\\n12| \\t\\t\\n13| }\\n```\\n\\n```\\n1| package main\\n2| \\n3| import \\\"concurrency/examples\\\"\\n4| \\n5| func main() {\\n6| \\texamples.RunHttpExample2()\\n7| \\t//examples.RunHttpUExample2()\\n8| }\\n9| package main\\n10|  func main() {\\n11| func main() {\\n12| \\t\\t\\n13| }\\n```\\n\\n## Result 9: github.com/grmartin/clion-go-lang-cmake/src/main/go/main.go\\n\\nURL: /github.com/grmartin/clion-go-lang-cmake/-/blob/src/main/go/main.go\\n\\n```\\n1| package main\\n2| \\n3| import \\\"fmt\\\"\\n4|  func main() {\\n5| func main() {\\n6| \\n7| \\tvar a string = \\\"initial\\\"\\n8| \\tfmt.Println(a)\\n9| \\tvar b, c int = 1, 2\\n10| \\tfmt.Println(b, c)\\n11| \\tvar d = true\\n12| \\tfmt.Println(d)\\n13| \\tvar e int\\n14| \\tfmt.Println(e)\\n```\\n\\n## Result 10: github.com/cubxxw/awesome-cloud-native/docs/code-docker-super/main/go-docker-1.go\\n\\nURL: /github.com/cubxxw/awesome-cloud-native/-/blob/docs/code-docker-super/main/go-docker-1.go\\n\\n```\\n1| package main\\n2| \\n3| import (\\n4| \\t\\\"fmt\\\"\\n5| \\t\\\"os\\\"\\n6| \\t\\\"os/exec\\\"\\n7| )\\n8|  func main() {\\n9| func main() {\\n10| \\tfmt.Println(os.Args)\\n11| \\tswitch os.Args[1] {\\t //获取第一个参数（从程序名开始）\\n12| \\tcase \\\"run\\\":\\n13| \\t\\trun()\\n14| \\tdefault:\\n15| \\t\\tpanic(\\\"have not define\\\")\\n16| \\t}\\n17| }\\n18| func run() {\\n```\\n\\n\",\"tool_call_id\":\"functions.sourcegraph:3\",\"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<cross_platform>\\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</cross_platform>\\n\\n<execution_steps>\\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 <cwd></cwd> tags\\n</execution_steps>\\n\\n<usage_notes>\\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</usage_notes>\\n\\n<git_commits>\\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 <commit_analysis> 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 &lt;&lt;'EOF'\\n   Commit message here.\\n\\n   \U0001F498 Generated with Crush\\n\\n\\n   Co-Authored-By: Crush <crush@charm.land>\\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</git_commits>\\n\\n<pull_requests>\\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 <pr_analysis> 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 &lt;&lt;'EOF'\\n\\n   ## Summary\\n\\n   &lt;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</pull_requests>\\n\\n<examples>\\nGood: pytest /foo/bar/tests\\nBad: cd /foo/bar && pytest tests\\n</examples>\\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<usage>\\n- Provide URL to download from\\n- Specify local file path where content should be saved\\n- Optional timeout for request\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<tips>\\n- Use absolute paths or paths relative to working directory\\n- Set appropriate timeouts for large files or slow connections\\n</tips>\\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<prerequisites>\\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</prerequisites>\\n\\n<parameters>\\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</parameters>\\n\\n<special_cases>\\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  </special_cases>\\n\\n<critical_requirements>\\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   </critical_requirements>\\n\\n<warnings>\\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</warnings>\\n\\n<recovery_steps>\\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   </recovery_steps>\\n\\n<best_practices>\\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  </best_practices>\\n\\n<whitespace_checklist>\\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      </whitespace_checklist>\\n\\n<examples>\\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</examples>\\n\\n<windows_notes>\\n\\n- Forward slashes work throughout (C:/path/file)\\n- File permissions handled automatically\\n- Line endings converted automatically (\\\\n ↔ \\\\r\\\\n)\\n  </windows_notes>\\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<prerequisites>\\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</prerequisites>\\n\\n<parameters>\\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</parameters>\\n\\n<operation>\\n- Edits applied sequentially in provided order.\\n- Each edit operates on result of previous edit.\\n- PARTIAL SUCCESS: If some edits fail, successful edits are still applied. Failed edits are returned in the response.\\n- File is modified if at least one edit succeeds.\\n- Ideal for several changes to different parts of same file.\\n</operation>\\n\\n<inherited_rules>\\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</inherited_rules>\\n\\n<critical_requirements>\\n1. Apply Edit tool rules to EACH edit (see edit.md).\\n2. Edits are applied in order; successful edits are kept even if later edits fail.\\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).\\n5. Check the response for failed edits and retry them if needed.\\n</critical_requirements>\\n\\n<verification_before_using>\\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</verification_before_using>\\n\\n<warnings>\\n- Operation continues even if some edits fail; check response for failed edits.\\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</warnings>\\n\\n<recovery_steps>\\nIf some edits fail:\\n1. Check the response metadata for the list of failed edits with their error messages.\\n2. View the file again to see the current state after successful edits.\\n3. Adjust the failed edits based on the new file content.\\n4. Retry the failed edits with corrected old_string values.\\n5. Consider breaking complex batches into smaller, independent operations.\\n</recovery_steps>\\n\\n<best_practices>\\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- Review failed edits in the response and retry with corrections.\\n</best_practices>\\n\\n<whitespace_checklist>\\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</whitespace_checklist>\\n\\n<examples>\\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✅ Correct: Handling partial success\\n\\n```\\n// If edit 2 fails, edit 1 is still applied\\n// Response will indicate:\\n// - edits_applied: 1\\n// - edits_failed: [{index: 2, error: \\\"...\\\", edit: {...}}]\\n// You can then retry edit 2 with corrected context\\n```\\n</examples>\\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<usage>\\n- Provide URL to fetch content from\\n- Specify desired output format (text, markdown, or html)\\n- Optional timeout for request\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<pattern_syntax>\\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</pattern_syntax>\\n\\n<examples>\\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</examples>\\n\\n<limitations>\\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</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<regex_syntax>\\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</regex_syntax>\\n\\n<include_patterns>\\n- '\\\\*.js' - Only search JavaScript files\\n- '\\\\*.{ts,tsx}' - Only search TypeScript files\\n- '\\\\*.go' - Only search Go files\\n</include_patterns>\\n\\n<limitations>\\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</limitations>\\n\\n<ignore_support>\\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</ignore_support>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide path to list (defaults to current working directory)\\n- Optional glob patterns to ignore\\n- Results displayed in tree structure\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\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</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide search query using Sourcegraph syntax\\n- Optional result count (default: 10, max: 20)\\n- Optional timeout for request\\n</usage>\\n\\n<basic_syntax>\\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</basic_syntax>\\n\\n<key_filters>\\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</key_filters>\\n\\n<examples>\\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</examples>\\n\\n<boolean_operators>\\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</boolean_operators>\\n\\n<limitations>\\n- Only searches public repositories\\n- Rate limits may apply\\n- Complex queries take longer\\n- Max 20 results per query\\n</limitations>\\n\\n<tips>\\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</tips>\\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<usage>\\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</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\n- Max file size: 250KB\\n- Default limit: 2000 lines\\n- Lines >2000 chars truncated\\n- Cannot display binary files/images (identifies them)\\n</limitations>\\n\\n<cross_platform>\\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</cross_platform>\\n\\n<tips>\\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</tips>\\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<usage>\\n- Provide file path to write\\n- Include content to write to file\\n- Tool creates necessary parent directories automatically\\n</usage>\\n\\n<features>\\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</features>\\n\\n<limitations>\\n- Read file before writing to avoid conflicts\\n- Cannot append (rewrites entire file)\\n</limitations>\\n\\n<cross_platform>\\n- Use forward slashes (/) for compatibility\\n</cross_platform>\\n\\n<tips>\\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</tips>\\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-1761739406-G7DEKhK3kWM2YovpR5ki","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739406,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}]}

      data: {"id":"gen-1761739406-G7DEKhK3kWM2YovpR5ki","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739406,"choices":[{"index":0,"delta":{"role":"assistant","content":"Found 30+ Go repositories with `func main()`. Results show various main function patterns from learning tutorials, tools, and production applications. Most common patterns include simple executables, CLI tools using command frameworks, and educational examples."},"finish_reason":"stop","native_finish_reason":"stop","logprobs":null}]}

      data: {"id":"gen-1761739406-G7DEKhK3kWM2YovpR5ki","provider":"DeepInfra","model":"moonshotai/kimi-k2-0905","object":"chat.completion.chunk","created":1761739406,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null,"native_finish_reason":null,"logprobs":null}],"usage":{"prompt_tokens":16209,"completion_tokens":46,"total_tokens":16255,"cost":0.0081965,"is_byok":false,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"cost_details":{"upstream_inference_cost":null,"upstream_inference_prompt_cost":0.0081045,"upstream_inference_completions_cost":0.000092},"completion_tokens_details":{"reasoning_tokens":0,"image_tokens":0}}}

      data: [DONE]

    headers:
      Content-Type:
      - text/event-stream
    status: 200 OK
    code: 200
    duration: 888.209875ms
